<template>
    <div class="pageContainer">
        <div class="searchWarp">
            <el-form inline>
                <template v-for="condition in listCondition">
                    <CText :title="condition.name" v-model="condition.value"></CText>
                </template>
            </el-form>
            <div class="schLine">
                <CBtn @click="search(1)">查询</CBtn>
            </div>
        </div>
        <div class="treeTable">
            <div style="flex:1;">
                <CPageTable :data="tableData" :curPage="paging.curPage" :total="paging.total" @changeSize="changeSize" @changePage="search">
                    <template slot-scope="scope">
                        <CBtn type="text" @click="showAudit(scope.row)">审核</CBtn>
                    </template>
                </CPageTable>
            </div>
        </div>
        <CDailog title="新增/编辑" :isShow="isShowEdit" @close="isShowEdit = false" @enter="doSave">
            <el-form :inline="true">
                <CText form readonly v-model="mm.account" title="帐号" field="account"></CText>
                <CText form readonly v-model="mm.realName" title="姓名" field="realName"></CText>
                <CText form readonly v-model="mm.nickName" title="呢称" field="nickName"></CText>
                <CText form readonly v-model="mm.mobile" title="手机号" field="mobile"></CText>
                <CSUpload readonly v-model="mm.imgHead" title="头像" field="imgHead"></CSUpload>
                <CText form v-model="mm.auditReason" title="审核意见" field="auditReason"></CText>
            </el-form>
            <template slot="footer" >
                <div class="el-dialog__footer">
                    <el-button @click="isShowEdit = false">取 消</el-button>
                    <el-button @click="doAudit(2)">审核不通过</el-button>
                    <el-button @click="doAudit(1)">审核通过</el-button>
                </div>
            </template>
            
        </CDailog>
    </div>
</template>

<script>
import pagingMixin from '@/mixin/pagingMixin'
export default {
    mixins: [pagingMixin],
    data() {
        return {
            model: "ums",
            table: "UmsUser"
            
        }
    },
    created() {
        this.templateId = "e6ef7f2d-1e6e-472b-98fa-17d567de54ef";
        
        //取得查询条件
        this.$sys.getPageConditions({id: this.templateId}).then(res => {
            this.listCondition = res.data;
        })
        //查询表格数据
        this.search(1);
    },
    methods: {
        showAudit(row) {
            this.$sys.getById(this.model, this.table, {id: row.id}).then(res => {
                this.mm = res.data;
                this.isShowEdit = true;
            })
        },
        doAudit(status) {
            this.mm.status = status;
            this.doSave();
        }
    }
}
</script>

<style lang="scss" scoped></style>